// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.Collections;
// import java.util.List;

#include "SQLShowStatisticStmt.h"
#include "../../visitor/SQLASTVisitor.h"
#include "SQLAssignItem.h"
#include "SQLExprTableSource.h"

SQLShowStatisticStmt::SQLShowStatisticStmt()
    : SQLStatementImpl(DbType_ptr(new DbType(&DbType::odps)))
{
  partitions = std::make_shared<std::list<SQLAssignItem_ptr>>();
  columns = std::make_shared<std::list<SQLName_ptr>>();
}

SQLExprTableSource_ptr SQLShowStatisticStmt::getTableSource()
{
  return tableSource;
}

void SQLShowStatisticStmt::setTableSource(SQLExprTableSource_ptr tableSource)
{
  this->tableSource = tableSource;
}

// @Override
void SQLShowStatisticStmt::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLShowStatisticStmt)))
  {
    acceptChild(visitor, tableSource);
  }
  visitor->endVisit(SharedObject(SQLShowStatisticStmt));
}

// @Override
SQLObject_list_ptr SQLShowStatisticStmt::getChildren()
{
  SQLObject_list_ptr tmp = std::make_shared<std::list<SQLObject_ptr>>();
  tmp->push_back(this->tableSource);
  return tmp;
}

BOOL_ptr SQLShowStatisticStmt::isFull()
{
  return full;
}

void SQLShowStatisticStmt::setFull(BOOL_ptr full)
{
  this->full = full;
}

SQLAssignItem_list_ptr SQLShowStatisticStmt::getPartitions()
{
  return partitions;
}

void SQLShowStatisticStmt::addPartition(SQLAssignItem_ptr partition)
{
  if (partition != nullptr)
  {
    partition->setParent(SharedObject(SQLShowStatisticStmt));
  }
  this->partitions->push_back(partition);
}

SQLName_list_ptr SQLShowStatisticStmt::getColumns()
{
  return columns;
}
